import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wk_weather/views/MyApp.dart';
import 'bloc/city/city_bloc.dart';
import 'bloc/weather/weather_bloc.dart';

void main(){
  runApp( BlocWrapper(child: MyApp()));
}

class BlocWrapper extends StatelessWidget {
  final Widget child;

  BlocWrapper({@required this.child});

  @override
  Widget build(BuildContext context) {
    return MultiBlocProvider(
      providers: [
        BlocProvider<CityBloc>(create: (_) => CityBloc( )..add(FetchCityDataEvent())),
        BlocProvider<WeatherBloc>(create: (_) => WeatherBloc( )),
      ],
      child: child,
    );
  }
}